﻿<Window x:Class="CPPEI.Coolzon.Designer.Views.DataSourceDetailWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CPPEI.Coolzon.Designer.Views"
        xmlns:ui="clr-namespace:CPPEI.Coolzon.UI;assembly=CPPEI.Coolzon.UI"
        xmlns:dataSet="clr-namespace:CPPEI.Coolzon.ServiceProxy.DesignServiceRef;assembly=CPPEI.Coolzon.ServiceProxy"
        xmlns:metadata="clr-namespace:CPPEI.Coolzon.Metadata;assembly=CPPEI.Coolzon.Metadata"
        mc:Ignorable="d"
        Title="数据源详细信息" Height="478" WindowStartupLocation="CenterScreen"  Width="Auto" Loaded="Window_Loaded" Closing="Window_Closing" SizeToContent="WidthAndHeight"  Style="{DynamicResource WindowStyle}">
    <Window.Resources>
        <ObjectDataProvider x:Key="CacheModeData" MethodName="GetValues" ObjectType="{x:Type metadata:CacheMode}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="metadata:CacheMode"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <local:VersionToString x:Key="versionTostring"/>
    </Window.Resources>
    <Grid x:Name="_ctlGrid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" MinWidth="200" MaxWidth="500"/>
            <ColumnDefinition Width="*" MinWidth="400"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Grid.Column="0"  MaxWidth="500">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="faName" Text="名称" Grid.Column="0" Grid.Row="0" Margin="3,5,3,3" />
            <TextBlock x:Name="faCaption" Text="描述" Grid.Column="0" Grid.Row="1" Margin="3,5,3,3" />
            <TextBlock x:Name="faType" Text="类型" Grid.Column="0" Grid.Row="2" Margin="3,5,3,3" />
            <TextBlock x:Name="faWidth" Text="版本" Grid.Column="0" Grid.Row="3" Margin="3,5,3,3" />
            <TextBlock x:Name="faHeight" Text="运行时版本" Grid.Column="0" Grid.Row="4" Margin="3,5,3,3" />
            <TextBlock x:Name="faAddress" Text="地址" Grid.Column="0" Grid.Row="5" Margin="3,5,3,3" />
            <TextBlock x:Name="faCacheMode" Text="缓存模式" Grid.Column="0" Grid.Row="6" Margin="3,5,3,3" />

            <ui:NameTextbox x:Name="_ctltbName" MaxLength="50" Grid.Column="1" Grid.Row="0" Text="{Binding Path=Name, Mode=OneTime}" Margin="3,3,3,3" />
            <TextBox x:Name="_ctltbCaption" Grid.Column="1" Grid.Row="1" Text="{Binding Path=Caption, Mode=OneTime}" MaxLength="50" Margin="3,3,3,3" />
            <TextBox x:Name="_ctltbType" MaxLength="50" Grid.Column="1" Grid.Row="2" Text="{Binding Path=Type, Mode=OneTime}" Margin="3,3,3,3" />

            <TextBox x:Name="_ctltbVersion" MaxLength="50" Grid.Column="1" Grid.Row="3"  Text="{Binding Path=Version, Mode=OneTime, Converter={StaticResource versionTostring}}" Margin="3,3,3,3"  />
            <TextBox x:Name="_ctltbRuntimeVertion" MaxLength="50" Grid.Column="1" Grid.Row="4"   Text="{Binding Path=RTVersion, Mode=OneTime, Converter={StaticResource versionTostring}}" Margin="3,3,3,3"   />
            <TextBox x:Name="_ctltbAddress" MaxLength="200" Grid.Column="1" Grid.Row="5"   Text="{Binding Path=Address, Mode=OneTime}" Margin="3,3,3,3"/>
            <ComboBox x:Name="_ctlcbCacheMode" Grid.Column="1" Grid.Row="6"   Margin="3,3,3,3" ItemsSource="{Binding Source={StaticResource CacheModeData}}" SelectedItem="{Binding Path=CacheMode, Mode=OneTime}">
            </ComboBox>
            <GroupBox Header="权限" Grid.Row="7" Grid.ColumnSpan="2"  >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="66" />
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="模式" Grid.Column="0" Grid.Row="0" Margin="3,5,3,3" />
                    <TextBlock Text="用户名" Grid.Column="0" Grid.Row="1" Margin="3,5,3,3" />
                    <TextBlock Text="密码" Grid.Column="0" Grid.Row="2" Margin="3,5,3,3" />

                    <TextBox x:Name="_ctltbMode" MaxLength="50" Grid.Column="1" Grid.Row="0" Text="{Binding Path=AuthenticationMode, Mode=OneTime}"   Margin="3,3,3,3" />
                    <TextBox x:Name="_ctltbUser" MaxLength="50" Grid.Column="1" Grid.Row="1" Text="{Binding Path=AuthenticationUser, Mode=OneTime}"   Margin="3,3,3,3"  />
                    <PasswordBox x:Name="_ctltbPwd" MaxLength="50" Grid.Column="1" Grid.Row="2" Margin="3,3,3,3" PasswordChar="*"    />
                </Grid>
            </GroupBox>
        </Grid>
        <GridSplitter BorderBrush="Gray" BorderThickness="1" Width="5" Grid.Row="0" Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Left" />
        <GroupBox Grid.Row="0" Grid.Column="1" Header="数据集" MinWidth="400" Margin="5,0,0,0" >
            <Grid MinWidth="400" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <StackPanel Style="{DynamicResource ButtonPanelBackground}"  x:Name="_ctlSPbtns" Grid.Row="0" Orientation="Horizontal">
                    <Button Name="_ctlAdd" Style="{DynamicResource AddButtonStyle}" FontSize="15" VerticalContentAlignment="Center" Width="36" Margin="3" ToolTip="增加" Click="_ctlAdd_Click"/>
                    <Button Name="_ctlRemove" Style="{DynamicResource RemoveButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="删除" Click="_ctlRemove_Click"/>
                    <Button Name="_ctlEdit" Style="{DynamicResource EditButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="编辑" Click="_ctlEdit_Click"/>
                    <Button x:Name="_ctlRetry" Style="{DynamicResource LongButtonStyle}" Content="获取失败,重新获取" Visibility="Collapsed"  Margin="3" Click="_ctlRetry_Click"/>
                </StackPanel>
                <TextBlock x:Name="_ctlHintMessage" Text="正在获取数据集列表..."  Grid.Row="1" Visibility="Collapsed"/>
                <ListView x:Name="_ctlDataSetList" Grid.Row="1" ItemsSource="{Binding Path=DataSets}" MouseDoubleClick="_ctlDataSetList_MouseDoubleClick" >
                    <ListView.ItemTemplate>
                        <DataTemplate DataType="dataSet:DataSet" >
                            <TextBlock Text="{Binding Name}" ToolTip="{Binding Caption}"/>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </Grid>
        </GroupBox>
        <Grid Grid.Row="1" Grid.ColumnSpan="2">
            <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Content="确定" Margin="0,0,20,0" Click="Button_Click" Width="75" />
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="cancel" Content="取消" Margin="20,0,0,0" Click="cancel_Click" Width="75"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
